<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>清博WCI指数计算</title>
	<style type="text/css">
		input[type="number"] {
			width: 80px;
		}
	</style>
</head>
<body>
	<div>
		<h1>清博WCI指数计算</h1>
		<p>公式 0.85 x ln(R/d + 1) + 0.09 x ln (Z/d * 10 + 1) + 0.06 x ln(L/d * 10 + 1) = 结果</p>
		<br/>
		<!-- <span>0.85 x </span><input id="read-number" type="number" name="read-number"> + 
		<span>0.09 x </span><input id="brower-number" type="number" name="brower-number"> + 
		<span>0.06 x </span><input id="like-number" type="number" name="like-number"> -->

		<p><span>R 阅读数：</span><input id="read-number" type="number" name="read-number"></p>
		<p><span>Z 在看数：</span><input id="brower-number" type="number" name="brower-number"></p>
		<p><span>L 点赞数：</span><input id="like-number" type="number" name="like-number"></p>
		<p><span>d 天数：</span><input id="day-number" type="number" name="day-number"></p>
		

		<button id="count-btn">计算结果</button>
		<button id="clear-btn">清空</button>
		<p>整体传播力 O 为: <span id="result">???</span></p>
		
	</div>
</body>
<script type="text/javascript">
	window.onload = function() {
		var countBtn = document.getElementById("count-btn");
		var clearBtn = document.getElementById("clear-btn");
		var resultDom = document.getElementById("result");
		var readNumber = document.getElementById("read-number");
		var browerNumber = document.getElementById("brower-number");
		var likeNumber = document.getElementById("like-number");
		var dayNumber = document.getElementById("day-number");

		countBtn.onclick = function() {
			var R = readNumber.value;
			var Z = browerNumber.value;
			var L = likeNumber.value;
			var d = dayNumber.value;
			console.log(R, Z, L, d);			
			var result = 0.85 * Math.log(R / d + 1) 
				+ 0.09 * Math.log(Z / d * 10 + 1) 
				+ 0.06 * Math.log(L / d * 10 + 1);
				resultDom.innerHTML = result;
		}
		clearBtn.onclick = function() {
			readNumber.value = 0;
			browerNumber.value = 0;
			likeNumber.value = 0;
			dayNumber.value = 0;
		}
	}
</script>
</html>